﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>培训课程预览</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link href="../../static/css/font.css" rel="stylesheet" />
    <link href="../../static/css/weadmin.css" rel="stylesheet" />
    <link href="../../lib/layui/css/layui.css" rel="stylesheet" />
    <script src="../../../lib/layui/layui.js"></script>
    <script src="../../../static/js/common.js" charset="utf-8"></script>

</head>
<body>
    <div class="layui-fluid fluid-position"><div class="layui-collapse" lay-filter="infos_form">
    <div class="layui-colla-item">
        <h2 class="layui-colla-title">培训课程</h2>
        <div class="layui-colla-content layui-show">
            <div class="layui-colla-item">
                <h2 class="layui-colla-title">基本信息</h2>
                <div class="layui-colla-content layui-show">
                    <div class="layui-form layui-form-pane">
                        <div class="layui-form-item">
                            <label class="layui-form-label">课程名称</label>
                            <div class="layui-input-block">
                                <input type="text" placeholder="课程名称" maxlength="50" class="layui-input" id="TCOName" name="TCOName" />
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">培训计划</label>
                            <div class="layui-input-block">
                                <input type="text" placeholder="培训计划" maxlength="50" class="layui-input" id="PrePlanName" name="PrePlanName" />
                            </div>
                        </div>

                        <!--时间-->
                        <div class="layui-form-item">
                            <label class="layui-form-label">培训教师</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" id="TrainTeacherName" name="TrainTeacherName" />
                            </div>

                            <label class="layui-form-label">教室</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" id="CRName" name="CRName" />
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">起止时间</label>
                                <div class="layui-input-inline">
                                    <input type="text" class="layui-input" id="StartDateTime" />
                                </div>
                                <label class="layui-form-label layui-form-label-inner layui-form-label-inner-w1">至</label>
                                <div class="layui-input-inline layui-form-label-inner">
                                    <input type="text" class="layui-input" id="EndDateTime" name="EndDateTime" />
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">时长(分钟)</label>
                                <div class="layui-input-inline">
                                    <input type="text" value="60" class="layui-input" id="Duration" maxlength="3" />
                                </div>
                            </div>

                        </div>

                        <div class="layui-form-item" id="selectDeptShow" style="display:none">
                            <div class="layui-form-label">选择部门</div>
                            <div class="layui-input-block">
                                <input type="text" autocomplete="off" readonly="" id="selectDatas" name="selectDatas" placeholder="请选择" class="layui-input" />
                                <div class="eleTree" id="eleTree" lay-filter="data5"></div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-form-label">参培人员</div>
                            <div class="layui-input-block">
                                <textarea name="" placeholder="参培人员" class="layui-textarea" maxlength="500" id="TrainUsers"></textarea>
                            </div>
                        </div>
                    </div>

                </div>
            </div>

            <div class="layui-colla-item">
                <h2 class="layui-colla-title">课程内容</h2>
                <div class="layui-colla-content layui-show">
                    <div class="layui-form layui-form-pane">
                        <button type="button" class="layui-btn layui-btn-normal" id="insertContent1" style="display:none">新增</button>
                        <div class="layui-form-item">

                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-colla-item">
                <h2 class="layui-colla-title">每周两题</h2>
                <div class="layui-colla-content layui-show">
                    <div class="layui-form layui-form-pane">
                        <button type="button" class="layui-btn layui-btn-normal" id="insertContent2" style="display:none">新增</button>
                        <div class="layui-form-item">

                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
</div>
        <div class="layui-row">
            <div class="layui-card">
                <div class="layui-card-body">
                    

                </div>
                

            </div>
        </div>
    </div>
    <script>

        var dis1 = "fr_";
        var dis2 = "sr_";

        var cellcontent1 = [];
        var cellcontent2 = [];

        layui.use(['form', 'laydate', 'table', 'jquery', 'element', 'layer', 'tree', 'util'], function () {
            var laydate = layui.laydate;
            var $ = layui.jquery;
            th = $(document).height();
            tw = $(document).width();
            var table = layui.table;
            var form = layui.form;
            var element = layui.element;
            var layer = layui.layer;
            var eleTree = layui.tree;
            $(function ($) { $.fn.layuiTextArea = function (options) { var defaults = { maxHeight: null, minHeight: $(this).height() }; var opts = $.extend({}, defaults, options); return $(this).each(function () { $(this).bind("paste cut keydown keyup focus blur", function () { var height, style = this.style; this.style.height = opts.minHeight + 'px'; if (this.scrollHeight > opts.minHeight) { if (opts.maxHeight && this.scrollHeight > opts.maxHeight) { height = opts.maxHeight; style.overflowY = 'scroll'; } else { height = this.scrollHeight; style.overflowY = 'hidden'; } style.height = height + 'px'; } }); }); }; });
            var TrainPlanName = getUrlParam("TrainPlanName");
            var TrainCourseName = getUrlParam("TrainCourseName");
            var StartDateTime = getUrlParam("StartDateTime");
            var EndDateTime = getUrlParam("EndDateTime");
            var Duration = getUrlParam("Duration");
            var CRName = getUrlParam("CRName");
            var TrainTeacherName = getUrlParam("TrainTeacherName");
            var TrainUsers = getUrlParam("TrainUsers");
            var TCOID = getUrlParam("TCOID");
            //            var content1 = getUrlParam("TrainUserscontent1");
            //var content2 = getUrlParam("TrainUserscontent2");
                        var content1 = "";
            var content2 = "";
            $.ajax({
                url: ApiUrl + "TrainCourseFiles/GetContentForTCOID?TCOID=" + TCOID,
                    type: 'get',
                    cache: false,
                    headers: {
                        "userid": JSON.parse(window.localStorage.authInfo).UserId,
                        "signtoken": JSON.parse(window.localStorage.authInfo).SignToken,
                    },
                    success: function (data) {
                        if (data.StatusCode == 200) {
                            for (var i = 0; i < data.Data.length; i++) {
                                var item = data.Data[i];
                                if (item.TCMark == "0") {
                                    content1 += item.TContent + "|";
                                }
                                if (item.TCMark == "1") {
                                    content2 += item.TContent + "|";
                                }
                            }
                            content1 = content1.substring(0, content1.length - 1);
                            content2 = content2.substring(0, content2.length - 1);
                            cellcontent1 = content1.split('|');
                            cellcontent2 = content2.split('|');

                            for (var i = 0; i < cellcontent1.length; i++) {
                                SetItems($("#insertContent1"), dis1, i + 1, cellcontent1[i])

                            }
                            for (var i = 0; i < cellcontent2.length; i++) {
                                SetItems($("#insertContent2"), dis2, i + 1, cellcontent2[i])
                            }
                        }
                        else if (data.StatusCode == 403) {
                            layer.alert(data.Info, function () {
                                //location.href = './login.html';
                                top.location.href = "http://" + top.location.host + "/login.html";
                            })
                        }
                        else {
                            layer.msg(data.Info);
                        }
                    }
                });






            function SetItems(obj, dis, index, value) {
                var c = obj.parent().find(".layui-form-item");
                var v = "<div class=\"layui-row\" id=\"" + dis + index + "\">";
                v += "<div class=\"layui-input-md1 layui-input-row\">";
                v += " <div class=\"layui-form-label\">" + index + "</div>";
                v += "<div class=\"layui-input-block\">";
                v += " <textarea rows=\"10\"  placeholder=\"内容\" class=\"layui-textarea\"  style=\"resize:none;width:1200px;\" >" + value + "</textarea>";
                v += "</div>";
                v += "</div>";
                ////v += "<div class=\"layui-input-md2 layui-input-row\">";
                ////v += "<input type=\"text\" placeholder=\"选择资料\"  class=\"layui-input layui-input-full\" name=\"ZName\"  />";
                ////v += "</div>";
                ////v += "<button type=\"button\" class=\"layui-btn layui-btn-danger\"  name=\"delitems\" >删除</button>";
                ////v += "</div>";
                c.append(v);
            }
            $("#TCOName").val(TrainCourseName);
            $("#PrePlanName").val(TrainPlanName);
            $("#TrainTeacherName").val(TrainTeacherName);
            $("#CRName").val(CRName);
            $("#StartDateTime").val(StartDateTime);
            $("#EndDateTime").val(EndDateTime);
            $("#Duration").val(Duration);
            $("#TrainUsers").val(TrainUsers);
            //$("#TCOName").val(TrainCourseName);
            $("textarea").layuiTextArea({
                maxHeight: 500,
            })
            //end
        });
    </script>
</body>
</html>